# -*- coding: utf-8 -*-
from tkinter import Tk
from tkinter import ttk

'''支持键值对的下拉框'''
class DictComboBox(ttk.Combobox):
    def __init__(self, master, dictionary, *args, **kw):
        ttk.Combobox.__init__(self, master, values = sorted(list(dictionary.keys())), state = 'readonly', *args, **kw)
        self.dictionary = dictionary
    
    '''获取下拉框值'''
    def getValue(self):
        return self.dictionary[self.get()]